/*
 * Version 0.2.1
 *
 * Copyright (c) 2010 Guet
 *
 * All rights reserved.
 *
 * Developed by: XGuru
 *
 */
#include "config.h"
#include "hash.h"
#define RET_CONTINUE 1
#define RET_EXIT -1
#define RET_SUCCESS 0

#define STRING_EQU(a, b) (strcmp((a),(b)) == 0)

struct settings
{
    int port;
    int is_deamon;
    int verbose;
    int max_client;
    int max_memory;
    int backlog;
    int item_size_max;        /* Maximum item size, and upper end for slabs */
};
struct already_read_data
{
    char *key;
    char *flag;
    char *exptime;
    char *length;
    int lock;
};
struct fly_status
{
    int pid;
    time_t uptime;
    char *version;
    time_t start_time;
    time_t time;
    int curr_items;
    int total_items;
    int curr_connections;
    int limit_maxbytes;
	int sockfd; 
};
void init_socket();
void init_status();
int setnonblocking(int sockfd);
void print_usage(char *argv);
int dispose_conn(int sockfd,int continue_read);
/*int prase_request(char *request,int sockfd);*/
int process_command();

int store_item(char *key,char *flag,char *exptime,char *length,char *value);
int delete_item(char *key);
int send_stats(int sockfd);
struct hashentry *get_item(char *key);
void flush_all();

